#include "loginwidget.h"

LoginWidget::LoginWidget(QWidget *parent) : QWidget(parent), ui(new Ui::LoginWidget){
    ui->setupUi(this);

    connect(ui->backButton,SIGNAL(clicked()),this,SIGNAL(back()));
    connect(ui->loginButton,SIGNAL(clicked()),this,SLOT(loginClicked()));

}

LoginWidget::~LoginWidget(){
    delete ui;
}

void LoginWidget::clearState(){
    ui->messageLabel->setText("<h1><\\h1>");
    ui->passwordLine->clear();
    ui->usernameLine->clear();
}

void LoginWidget::loginClicked(){
    emit login(ui->usernameLine->text(),ui->passwordLine->text());
}

void LoginWidget::displayLoginError(){
    ui->messageLabel->setText("<h1>Wrong Username/Password Combination</h1>");
}

void LoginWidget::displayConnectionError(){
    ui->messageLabel->setText("<h1>Connection Error Please Try Again Later</h1>");
}
